package com.xw.childhealth.service.impl;

import com.xw.childhealth.dao.PersonnelCodeDao;
import com.xw.childhealth.entity.PersonnelCode;
import com.xw.childhealth.service.PersonnelCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @Author: y
 * @CreateDate: 2019-11-12 08:52
 * @Version: 1.0
 */
@Service
public class PersonnelCodeServiceImpl implements PersonnelCodeService {

    @Autowired
    private PersonnelCodeDao personnelCodeDao;

    @Override
    public Page<PersonnelCode> findAllPersonnelCode(Pageable pageable) {
        return personnelCodeDao.findAll(pageable);
    }

    @Override
    public PersonnelCode findOneById(Integer id) {
        return personnelCodeDao.findByIdEquals(id);
    }

    @Override
    public PersonnelCode save(PersonnelCode personnelCode) {
        return personnelCodeDao.save(personnelCode);
    }

    @Override
    public void delOneById(Integer id) {
        personnelCodeDao.deleteById(id);
    }

    @Override
    public Page<PersonnelCode> findAllPersonnelCode(Specification<PersonnelCode> specification, PageRequest pageRequest) {
        return personnelCodeDao.findAll(specification, pageRequest);
    }
}
